home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / doom / quake.zip / TORNADO.ZIP / CLIENT.QC next >
Text File  |  1997-04-30  |  33KB  |  1,470 lines

  1.  
  2. // prototypes
  3. void () W_WeaponFrame;
  4. void() W_SetCurrentAmmo;
  5. void() player_pain;
  6. void() player_stand1;
  7. void (vector org) spawn_tfog;
  8. void (vector org, entity death_owner) spawn_tdeath;
  9.  
  10. float    modelindex_eyes, modelindex_player;
  11.  
  12. /*
  13. =============================================================================
  14.  
  15.                 LEVEL CHANGING / INTERMISSION
  16.  
  17. =============================================================================
  18. */
  19.  
  20. float    intermission_running;
  21. float    intermission_exittime;
  22.  
  23. /*QUAKED info_intermission (1 0.5 0.5) (-16 -16 -16) (16 16 16)
  24. This is the camera point for the intermission.
  25. Use mangle instead of angle, so you can set pitch or roll as well as yaw.  'pitch roll yaw'
  26. */
  27. void() info_intermission =
  28. {
  29. };
  30.  
  31.  
  32.  
  33. void() SetChangeParms =
  34. {
  35.     if (self.health <= 0)
  36.     {
  37.         SetNewParms ();
  38.         return;
  39.     }
  40.  
  41. // remove items
  42.     self.items = self.items - (self.items & 
  43.     (IT_KEY1 | IT_KEY2 | IT_INVISIBILITY | IT_INVULNERABILITY | IT_SUIT | IT_QUAD) );
  44.     
  45. // cap super health
  46.     if (self.health > 100)
  47.         self.health = 100;
  48.     if (self.health < 50)
  49.         self.health = 50;
  50.     parm1 = self.items;
  51.     parm2 = self.health;
  52.     parm3 = self.armorvalue;
  53.     if (self.ammo_shells < 25)
  54.         parm4 = 25;
  55.     else
  56.         parm4 = self.ammo_shells;
  57.     parm5 = self.ammo_nails;
  58.     parm6 = self.ammo_rockets;
  59.     parm7 = self.ammo_cells;
  60.     parm8 = self.weapon;
  61.     parm9 = self.armortype * 100;
  62. };
  63.  
  64. void() SetNewParms =
  65. {
  66.     parm1 = IT_SHOTGUN | IT_AXE;
  67.     parm2 = 100;
  68.     parm3 = 0;
  69.     parm4 = 25;
  70.     parm5 = 0;
  71.     parm6 = 0;
  72.     parm7 = 0;
  73.     parm8 = 1;
  74.     parm9 = 0;
  75. };
  76.  
  77. void() DecodeLevelParms =
  78. {
  79.     if (serverflags)
  80.     {
  81.         if (world.model == "maps/start.bsp")
  82.             SetNewParms ();        // take away all stuff on starting new episode
  83.     }
  84.     
  85.     self.items = parm1;
  86.     self.health = parm2;
  87.     self.armorvalue = parm3;
  88.     self.ammo_shells = parm4;
  89.     self.ammo_nails = parm5;
  90.     self.ammo_rockets = parm6;
  91.     self.ammo_cells = parm7;
  92.     self.weapon = parm8;
  93.     self.armortype = parm9 * 0.01;
  94. };
  95.  
  96. /*
  97. ============
  98. FindIntermission
  99.  
  100. Returns the entity to view from
  101. ============
  102. */
  103. entity() FindIntermission =
  104. {
  105.     local    entity spot;
  106.     local    float cyc;
  107.  
  108. // look for info_intermission first
  109.     spot = find (world, classname, "info_intermission");
  110.     if (spot)
  111.     {    // pick a random one
  112.         cyc = random() * 4;
  113.         while (cyc > 1)
  114.         {
  115.             spot = find (spot, classname, "info_intermission");
  116.             if (!spot)
  117.                 spot = find (spot, classname, "info_intermission");
  118.             cyc = cyc - 1;
  119.         }
  120.         return spot;
  121.     }
  122.  
  123. // then look for the start position
  124.     spot = find (world, classname, "info_player_start");
  125.     if (spot)
  126.         return spot;
  127.     
  128. // testinfo_player_start is only found in regioned levels
  129.     spot = find (world, classname, "testplayerstart");
  130.     if (spot)
  131.         return spot;
  132.     
  133.     objerror ("FindIntermission: no spot");
  134. };
  135.  
  136.  
  137. string nextmap;
  138. void() GotoNextMap =
  139. {
  140.     if (cvar("samelevel"))    // if samelevel is set, stay on same level
  141.         changelevel (mapname);
  142.     else
  143.         changelevel (nextmap);
  144. };
  145.  
  146.  
  147. void() ExitIntermission =
  148. {
  149. // skip any text in deathmatch
  150.     if (deathmatch)
  151.     {
  152.         GotoNextMap ();
  153.         return;
  154.     }
  155.     
  156.     intermission_exittime = time + 1;
  157.     intermission_running = intermission_running + 1;
  158.  
  159. //
  160. // run some text if at the end of an episode
  161. //
  162.     if (intermission_running == 2)
  163.     {
  164.         if (world.model == "maps/e1m7.bsp")
  165.         {
  166.             WriteByte (MSG_ALL, SVC_CDTRACK);
  167.             WriteByte (MSG_ALL, 2);
  168.             WriteByte (MSG_ALL, 3);
  169.             if (!cvar("registered"))
  170.             {
  171.                 WriteByte (MSG_ALL, SVC_FINALE);
  172.                 WriteString (MSG_ALL, "As the corpse of the monstrous entity\nChthon sinks back into the lava whence\nit rose, you grip the Rune of Earth\nMagic tightly. Now that you have\nconquered the Dimension of the Doomed,\nrealm of Earth Magic, you are ready to\ncomplete your task in the other three\nhaunted lands of Quake. Or are you? If\nyou don't register Quake, you'll never\nknow what awaits you in the Realm of\nBlack Magic, the Netherworld, and the\nElder World!");
  173.             }
  174.             else
  175.             {
  176.                 WriteByte (MSG_ALL, SVC_FINALE);
  177.                 WriteString (MSG_ALL, "As the corpse of the monstrous entity\nChthon sinks back into the lava whence\nit rose, you grip the Rune of Earth\nMagic tightly. Now that you have\nconquered the Dimension of the Doomed,\nrealm of Earth Magic, you are ready to\ncomplete your task. A Rune of magic\npower lies at the end of each haunted\nland of Quake. Go forth, seek the\ntotality of the four Runes!");
  178.             }
  179.             return;
  180.         }
  181.         else if (world.model == "maps/e2m6.bsp")
  182.         {
  183.             WriteByte (MSG_ALL, SVC_CDTRACK);
  184.             WriteByte (MSG_ALL, 2);
  185.             WriteByte (MSG_ALL, 3);
  186.  
  187.             WriteByte (MSG_ALL, SVC_FINALE);
  188.             WriteString (MSG_ALL, "The Rune of Black Magic throbs evilly in\nyour hand and whispers dark thoughts\ninto your brain. You learn the inmost\nlore of the Hell-Mother; Shub-Niggurath!\nYou now know that she is behind all the\nterrible plotting which has led to so\nmuch death and horror. But she is not\ninviolate! Armed with this Rune, you\nrealize that once all four Runes are\ncombined, the gate to Shub-Niggurath's\nPit will open, and you can face the\nWitch-Goddess herself in her frightful\notherworld cathedral.");
  189.             return;
  190.         }
  191.         else if (world.model == "maps/e3m6.bsp")
  192.         {
  193.             WriteByte (MSG_ALL, SVC_CDTRACK);
  194.             WriteByte (MSG_ALL, 2);
  195.             WriteByte (MSG_ALL, 3);
  196.  
  197.             WriteByte (MSG_ALL, SVC_FINALE);
  198.             WriteString (MSG_ALL, "The charred viscera of diabolic horrors\nbubble viscously as you seize the Rune\nof Hell Magic. Its heat scorches your\nhand, and its terrible secrets blight\nyour mind. Gathering the shreds of your\ncourage, you shake the devil's shackles\nfrom your soul, and become ever more\nhard and determined to destroy the\nhideous creatures whose mere existence\nthreatens the souls and psyches of all\nthe population of Earth.");
  199.             return;
  200.         }
  201.         else if (world.model == "maps/e4m7.bsp")
  202.         {
  203.             WriteByte (MSG_ALL, SVC_CDTRACK);
  204.             WriteByte (MSG_ALL, 2);
  205.             WriteByte (MSG_ALL, 3);
  206.  
  207.             WriteByte (MSG_ALL, SVC_FINALE);
  208.             WriteString (MSG_ALL, "Despite the awful might of the Elder\nWorld, you have achieved the Rune of\nElder Magic, capstone of all types of\narcane wisdom. Beyond good and evil,\nbeyond life and death, the Rune\npulsates, heavy with import. Patient and\npotent, the Elder Being Shub-Niggurath\nweaves her dire plans to clear off all\nlife from the Earth, and bring her own\nfoul offspring to our world! For all the\ndwellers in these nightmare dimensions\nare her descendants! Once all Runes of\nmagic power are united, the energy\nbehind them will blast open the Gateway\nto Shub-Niggurath, and you can travel\nthere to foil the Hell-Mother's plots\nin person.");
  209.             return;
  210.         }
  211.  
  212.         GotoNextMap();
  213.     }
  214.     
  215.     if (intermission_running == 3)
  216.     {
  217.         if (!cvar("registered"))
  218.         {    // shareware episode has been completed, go to sell screen
  219.             WriteByte (MSG_ALL, SVC_SELLSCREEN);
  220.             return;
  221.         }
  222.         
  223.         if ( (serverflags&15) == 15)
  224.         {
  225.             WriteByte (MSG_ALL, SVC_FINALE);
  226.             WriteString (MSG_ALL, "Now, you have all four Runes. You sense\ntremendous invisible forces moving to\nunseal ancient barriers. Shub-Niggurath\nhad hoped to use the Runes Herself to\nclear off the Earth, but now instead,\nyou will use them to enter her home and\nconfront her as an avatar of avenging\nEarth-life. If you defeat her, you will\nbe remembered forever as the savior of\nthe planet. If she conquers, it will be\nas if you had never been born.");
  227.             return;
  228.         }
  229.         
  230.     }
  231.  
  232.     GotoNextMap();
  233. };
  234.  
  235. /*
  236. ============
  237. IntermissionThink
  238.  
  239. When the player presses attack or jump, change to the next level
  240. ============
  241. */
  242. void() IntermissionThink =
  243. {
  244.     if (time < intermission_exittime)
  245.         return;
  246.  
  247.     if (!self.button0 && !self.button1 && !self.button2)
  248.         return;
  249.     
  250.     ExitIntermission ();
  251. };
  252.  
  253. void() execute_changelevel =
  254. {
  255.     local entity    pos;
  256.  
  257.     intermission_running = 1;
  258.     
  259. // enforce a wait time before allowing changelevel
  260.     if (deathmatch)
  261.         intermission_exittime = time + 5;
  262.     else
  263.         intermission_exittime = time + 2;
  264.  
  265.     WriteByte (MSG_ALL, SVC_CDTRACK);
  266.     WriteByte (MSG_ALL, 3);
  267.     WriteByte (MSG_ALL, 3);
  268.     
  269.     pos = FindIntermission ();
  270.  
  271.     other = find (world, classname, "player");
  272.     while (other != world)
  273.     {
  274.         other.view_ofs = '0 0 0';
  275.         other.angles = other.v_angle = pos.mangle;
  276.         other.fixangle = TRUE;        // turn this way immediately
  277.         other.nextthink = time + 0.5;
  278.         other.takedamage = DAMAGE_NO;
  279.         other.solid = SOLID_NOT;
  280.         other.movetype = MOVETYPE_NONE;
  281.         other.modelindex = 0;
  282.         setorigin (other, pos.origin);
  283.         other = find (other, classname, "player");
  284.     }    
  285.  
  286.     WriteByte (MSG_ALL, SVC_INTERMISSION);
  287. };
  288.  
  289.  
  290. void() changelevel_touch =
  291. {
  292.     local entity    pos;
  293.  
  294.     if (other.classname != "player")
  295.         return;
  296.  
  297.     if ((cvar("noexit") == 1) || ((cvar("noexit") == 2) && (mapname != "start")))
  298.     {
  299.         T_Damage (other, self, self, 50000);
  300.         return;
  301.     }
  302.  
  303.     if (coop || deathmatch)
  304.     {
  305.         bprint (other.netname);
  306.         bprint (" exited the level\n");
  307.     }
  308.     
  309.     nextmap = self.map;
  310.  
  311.     SUB_UseTargets ();
  312.  
  313.     if ( (self.spawnflags & 1) && (deathmatch == 0) )
  314.     {    // NO_INTERMISSION
  315.         GotoNextMap();
  316.         return;
  317.     }
  318.     
  319.     self.touch = SUB_Null;
  320.  
  321. // we can't move people right now, because touch functions are called
  322. // in the middle of C movement code, so set a think time to do it
  323.     self.think = execute_changelevel;
  324.     self.nextthink = time + 0.1;
  325. };
  326.  
  327. /*QUAKED trigger_changelevel (0.5 0.5 0.5) ? NO_INTERMISSION
  328. When the player touches this, he gets sent to the map listed in the "map" variable.  Unless the NO_INTERMISSION flag is set, the view will go to the info_intermission spot and display stats.
  329. */
  330. void() trigger_changelevel =
  331. {
  332.     if (!self.map)
  333.         objerror ("chagnelevel trigger doesn't have map");
  334.     
  335.     InitTrigger ();
  336.     self.touch = changelevel_touch;
  337. };
  338.  
  339.  
  340. /*
  341. =============================================================================
  342.  
  343.                 PLAYER GAME EDGE FUNCTIONS
  344.  
  345. =============================================================================
  346. */
  347.  
  348. void() set_suicide_frame;
  349.  
  350. // called by ClientKill and DeadThink
  351. void() respawn =
  352. {
  353.     if (coop)
  354.     {
  355.         // make a copy of the dead body for appearances sake
  356.         CopyToBodyQue (self);
  357.         // get the spawn parms as they were at level start
  358.         setspawnparms (self);
  359.         // respawn        
  360.         PutClientInServer ();
  361.     }
  362.     else if (deathmatch)
  363.     {
  364.         // make a copy of the dead body for appearances sake
  365.         CopyToBodyQue (self);
  366.         // set default spawn parms
  367.         SetNewParms ();
  368.         // respawn        
  369.         PutClientInServer ();
  370.     }
  371.     else
  372.     {    // restart the entire server
  373.         localcmd ("restart\n");
  374.     }
  375. };
  376.  
  377.  
  378. /*
  379. ============
  380. ClientKill
  381.  
  382. Player entered the suicide command
  383. ============
  384. */
  385. void() ClientKill =
  386. {
  387.     bprint (self.netname);
  388.     bprint (" suicides\n");
  389.     set_suicide_frame ();
  390.     self.modelindex = modelindex_player;
  391.     self.frags = self.frags - 2;    // extra penalty
  392.     respawn ();
  393. };
  394.  
  395. float(vector v) CheckSpawnPoint =
  396. {
  397.     return FALSE;
  398. };
  399.  
  400. /*
  401. ============
  402. SelectSpawnPoint
  403.  
  404. Returns the entity to spawn at
  405. ============
  406. */
  407. entity() SelectSpawnPoint =
  408. {
  409.     local    entity spot;
  410.     local    entity thing;
  411.     local    float  pcount;
  412.     
  413. // testinfo_player_start is only found in regioned levels
  414.     spot = find (world, classname, "testplayerstart");
  415.     if (spot)
  416.         return spot;
  417.         
  418. // choose a info_player_deathmatch point
  419.     if (coop)
  420.     {
  421.         lastspawn = find(lastspawn, classname, "info_player_coop");
  422.         if (lastspawn == world)
  423.             lastspawn = find (lastspawn, classname, "info_player_start");
  424.         if (lastspawn != world)
  425.             return lastspawn;
  426.     }
  427.     else if (deathmatch)
  428.     {
  429.         spot = lastspawn;
  430.         while (1)
  431.         {
  432.             spot = find(spot, classname, "info_player_deathmatch");
  433.             if (spot != world)
  434.             {
  435.                 if (spot == lastspawn)
  436.                     return lastspawn;
  437.                 pcount = 0;
  438.                 thing = findradius(spot.origin, 32);
  439.                 while(thing)
  440.                 {
  441.                     if (thing.classname == "player")
  442.                         pcount = pcount + 1;
  443.                     thing = thing.chain;
  444.                 }
  445.                 if (pcount == 0)
  446.                 {
  447.                     lastspawn = spot;
  448.                     return spot;
  449.                 }
  450.             }
  451.         }
  452.     }
  453.  
  454.     if (serverflags)
  455.     {    // return with a rune to start
  456.         spot = find (world, classname, "info_player_start2");
  457.         if (spot)
  458.             return spot;
  459.     }
  460.     
  461.     spot = find (world, classname, "info_player_start");
  462.     if (!spot)
  463.         error ("PutClientInServer: no info_player_start on level");
  464.     
  465.     return spot;
  466. };
  467.  
  468. /*
  469. ===========
  470. PutClientInServer
  471.  
  472. called each time a player is spawned
  473. ============
  474. */
  475. void() DecodeLevelParms;
  476. void() PlayerDie;
  477.  
  478.  
  479. void() PutClientInServer =
  480. {
  481.     local    entity spot;
  482.  
  483.     spot = SelectSpawnPoint ();
  484.  
  485.     self.classname = "player";
  486.     self.health = 100;
  487.     self.takedamage = DAMAGE_AIM;
  488.     self.solid = SOLID_SLIDEBOX;
  489.     self.movetype = MOVETYPE_WALK;
  490.     self.show_hostile = 0;
  491.     self.max_health = 100;
  492.     self.flags = FL_CLIENT;
  493.     self.air_finished = time + 12;
  494.     self.dmg = 2;           // initial water damage
  495.     self.super_damage_finished = 0;
  496.     self.radsuit_finished = 0;
  497.     self.invisible_finished = 0;
  498.     self.invincible_finished = 0;
  499.     self.effects = 0;
  500.     self.invincible_time = 0;
  501.  
  502.     DecodeLevelParms ();
  503.     
  504.     W_SetCurrentAmmo ();
  505.  
  506.     self.attack_finished = time;
  507.     self.th_pain = player_pain;
  508.     self.th_die = PlayerDie;
  509.     
  510.     self.deadflag = DEAD_NO;
  511. // paustime is set by teleporters to keep the player from moving a while
  512.     self.pausetime = 0;
  513.     
  514. //    spot = SelectSpawnPoint ();
  515.  
  516.     self.origin = spot.origin + '0 0 1';
  517.     self.angles = spot.angles;
  518.     self.fixangle = TRUE;        // turn this way immediately
  519.  
  520. // oh, this is a hack!
  521.     setmodel (self, "progs/eyes.mdl");
  522.     modelindex_eyes = self.modelindex;
  523.  
  524.     setmodel (self, "progs/player.mdl");
  525.     modelindex_player = self.modelindex;
  526.  
  527.     setsize (self, VEC_HULL_MIN, VEC_HULL_MAX);
  528.     
  529.     self.view_ofs = '0 0 22';
  530.  
  531.     player_stand1 ();
  532.     
  533.     if (deathmatch || coop)
  534.     {
  535.         makevectors(self.angles);
  536.         spawn_tfog (self.origin + v_forward*20);
  537.     }
  538.  
  539.     spawn_tdeath (self.origin, self);
  540. };
  541.  
  542.  
  543. /*
  544. =============================================================================
  545.  
  546.                 QUAKED FUNCTIONS
  547.  
  548. =============================================================================
  549. */
  550.  
  551.  
  552. /*QUAKED info_player_start (1 0 0) (-16 -16 -24) (16 16 24)
  553. The normal starting point for a level.
  554. */
  555. void() info_player_start =
  556. {
  557. };
  558.  
  559.  
  560. /*QUAKED info_player_start2 (1 0 0) (-16 -16 -24) (16 16 24)
  561. Only used on start map for the return point from an episode.
  562. */
  563. void() info_player_start2 =
  564. {
  565. };
  566.  
  567.  
  568. /*
  569. saved out by quaked in region mode
  570. */
  571. void() testplayerstart =
  572. {
  573. };
  574.  
  575. /*QUAKED info_player_deathmatch (1 0 1) (-16 -16 -24) (16 16 24)
  576. potential spawning position for deathmatch games
  577. */
  578. void() info_player_deathmatch =
  579. {
  580. };
  581.  
  582. /*QUAKED info_player_coop (1 0 1) (-16 -16 -24) (16 16 24)
  583. potential spawning position for coop games
  584. */
  585. void() info_player_coop =
  586. {
  587. };
  588.  
  589. /*
  590. ===============================================================================
  591.  
  592. RULES
  593.  
  594. ===============================================================================
  595. */
  596.  
  597. /*
  598. go to the next level for deathmatch
  599. only called if a time or frag limit has expired
  600. */
  601. void() NextLevel =
  602. {
  603.     local entity o;
  604.  
  605.     if (mapname == "start")
  606.     {
  607.         if (!cvar("registered"))
  608.         {
  609.             mapname = "e1m1";
  610.         }
  611.         else if (!(serverflags & 1))
  612.         {
  613.             mapname = "e1m1";
  614.             serverflags = serverflags | 1;
  615.         }
  616.         else if (!(serverflags & 2))
  617.         {
  618.             mapname = "e2m1";
  619.             serverflags = serverflags | 2;
  620.         }
  621.         else if (!(serverflags & 4))
  622.         {
  623.             mapname = "e3m1";
  624.             serverflags = serverflags | 4;
  625.         }
  626.         else if (!(serverflags & 8))
  627.         {
  628.             mapname = "e4m1";
  629.             serverflags = serverflags - 7;
  630.         }
  631.  
  632.         o = spawn();
  633.         o.map = mapname;
  634.     }
  635.     else
  636.     {
  637.         // find a trigger changelevel
  638.         o = find(world, classname, "trigger_changelevel");
  639.  
  640.         // go back to start if no trigger_changelevel
  641.         if (!o)
  642.         {
  643.             mapname = "start";
  644.             o = spawn();
  645.             o.map = mapname;
  646.         }
  647.     }
  648.  
  649.     nextmap = o.map;
  650.     gameover = TRUE;
  651.     
  652.     if (o.nextthink < time)
  653.     {
  654.         o.think = execute_changelevel;
  655.         o.nextthink = time + 0.1;
  656.     }
  657. };
  658.  
  659. /*
  660. ============
  661. CheckRules
  662.  
  663. Exit deathmatch games upon conditions
  664. ============
  665. */
  666. void() CheckRules =
  667. {
  668.     local    float        timelimit;
  669.     local    float        fraglimit;
  670.     
  671.     if (gameover)    // someone else quit the game already
  672.         return;
  673.         
  674.     timelimit = cvar("timelimit") * 60;
  675.     fraglimit = cvar("fraglimit");
  676.     
  677.     if (timelimit && time >= timelimit)
  678.     {
  679.         NextLevel ();
  680.         return;
  681.     }
  682.     
  683.     if (fraglimit && self.frags >= fraglimit)
  684.     {
  685.         NextLevel ();
  686.         return;
  687.     }    
  688. };
  689.  
  690. //============================================================================
  691.  
  692. void() PlayerDeathThink =
  693. {
  694.     local entity    old_self;
  695.     local float        forward;
  696.  
  697.     if ((self.flags & FL_ONGROUND))
  698.     {
  699.         forward = vlen (self.velocity);
  700.         forward = forward - 20;
  701.         if (forward <= 0)
  702.             self.velocity = '0 0 0';
  703.         else    
  704.             self.velocity = forward * normalize(self.velocity);
  705.     }
  706.  
  707. // wait for all buttons released
  708.     if (self.deadflag == DEAD_DEAD)
  709.     {
  710.         if (self.button2 || self.button1 || self.button0)
  711.             return;
  712.         self.deadflag = DEAD_RESPAWNABLE;
  713.         return;
  714.     }
  715.  
  716. // wait for any button down
  717.     if (!self.button2 && !self.button1 && !self.button0)
  718.         return;
  719.  
  720.     self.button0 = 0;
  721.     self.button1 = 0;
  722.     self.button2 = 0;
  723.     respawn();
  724. };
  725.  
  726.  
  727. void() PlayerJump =
  728. {
  729.     local vector start, end;
  730.     
  731.     if (self.flags & FL_WATERJUMP)
  732.         return;
  733.     
  734.     if (self.waterlevel >= 2)
  735.     {
  736.         if (self.watertype == CONTENT_WATER)
  737.             self.velocity_z = 100;
  738.         else if (self.watertype == CONTENT_SLIME)
  739.             self.velocity_z = 80;
  740.         else
  741.             self.velocity_z = 50;
  742.  
  743. // play swiming sound
  744.         if (self.swim_flag < time)
  745.         {
  746.             self.swim_flag = time + 1;
  747.             if (random() < 0.5)
  748.                 sound (self, CHAN_BODY, "misc/water1.wav", 1, ATTN_NORM);
  749.             else
  750.                 sound (self, CHAN_BODY, "misc/water2.wav", 1, ATTN_NORM);
  751.         }
  752.  
  753.         return;
  754.     }
  755.  
  756.     if (!(self.flags & FL_ONGROUND))
  757.         return;
  758.  
  759.     if ( !(self.flags & FL_JUMPRELEASED) )
  760.         return;        // don't pogo stick
  761.  
  762.     self.flags = self.flags - (self.flags & FL_JUMPRELEASED);
  763.  
  764.     self.flags = self.flags - FL_ONGROUND;    // don't stairwalk
  765.     
  766.     self.button2 = 0;
  767. // player jumping sound
  768.     sound (self, CHAN_BODY, "player/plyrjmp8.wav", 1, ATTN_NORM);
  769.     self.velocity_z = self.velocity_z + 270;
  770. };
  771.  
  772.  
  773. /*
  774. ===========
  775. WaterMove
  776.  
  777. ============
  778. */
  779. .float    dmgtime;
  780.  
  781. void() WaterMove =
  782. {
  783. //dprint (ftos(self.waterlevel));
  784.     if (self.movetype == MOVETYPE_NOCLIP)
  785.         return;
  786.     if (self.health < 0)
  787.         return;
  788.  
  789.     if (self.waterlevel != 3)
  790.     {
  791.         if (self.air_finished < time)
  792.             sound (self, CHAN_VOICE, "player/gasp2.wav", 1, ATTN_NORM);
  793.         else if (self.air_finished < time + 9)
  794.             sound (self, CHAN_VOICE, "player/gasp1.wav", 1, ATTN_NORM);
  795.         self.air_finished = time + 12;
  796.         self.dmg = 2;
  797.     }
  798.     else if (self.air_finished < time)
  799.     {    // drown!
  800.         if (self.pain_finished < time)
  801.         {
  802.             self.dmg = self.dmg + 2;
  803.             if (self.dmg > 15)
  804.                 self.dmg = 10;
  805.             T_Damage (self, world, world, self.dmg);
  806.             self.pain_finished = time + 1;
  807.         }
  808.     }
  809.     
  810.     if (!self.waterlevel)
  811.     {
  812.         if (self.flags & FL_INWATER)
  813.         {    
  814.             // play leave water sound
  815.             sound (self, CHAN_BODY, "misc/outwater.wav", 1, ATTN_NORM);
  816.             self.flags = self.flags - FL_INWATER;
  817.         }
  818.         return;
  819.     }
  820.  
  821.     if (self.watertype == CONTENT_LAVA)
  822.     {    // do damage
  823.         if (self.dmgtime < time)
  824.         {
  825.             if (self.radsuit_finished > time)
  826.                 self.dmgtime = time + 1;
  827.             else
  828.                 self.dmgtime = time + 0.2;
  829.  
  830.             T_Damage (self, world, world, 10*self.waterlevel);
  831.         }
  832.     }
  833.     else if (self.watertype == CONTENT_SLIME)
  834.     {    // do damage
  835.         if (self.dmgtime < time && self.radsuit_finished < time)
  836.         {
  837.             self.dmgtime = time + 1;
  838.             T_Damage (self, world, world, 4*self.waterlevel);
  839.         }
  840.     }
  841.     
  842.     if ( !(self.flags & FL_INWATER) )
  843.     {    
  844.  
  845. // player enter water sound
  846.  
  847.         if (self.watertype == CONTENT_LAVA)
  848.             sound (self, CHAN_BODY, "player/inlava.wav", 1, ATTN_NORM);
  849.         if (self.watertype == CONTENT_WATER)
  850.             sound (self, CHAN_BODY, "player/inh2o.wav", 1, ATTN_NORM);
  851.         if (self.watertype == CONTENT_SLIME)
  852.             sound (self, CHAN_BODY, "player/slimbrn2.wav", 1, ATTN_NORM);
  853.  
  854.         self.flags = self.flags + FL_INWATER;
  855.         self.dmgtime = 0;
  856.     }
  857.     
  858.     if (! (self.flags & FL_WATERJUMP) )
  859.         self.velocity = self.velocity - 0.8*self.waterlevel*frametime*self.velocity;
  860. };
  861.  
  862. void() CheckWaterJump =
  863. {
  864.     local vector start, end;
  865.  
  866. // check for a jump-out-of-water
  867.     makevectors (self.angles);
  868.     start = self.origin;
  869.     start_z = start_z + 8; 
  870.     v_forward_z = 0;
  871.     normalize(v_forward);
  872.     end = start + v_forward*24;
  873.     traceline (start, end, TRUE, self);
  874.     if (trace_fraction < 1)
  875.     {    // solid at waist
  876.         start_z = start_z + self.maxs_z - 8;
  877.         end = start + v_forward*24;
  878.         self.movedir = trace_plane_normal * -50;
  879.         traceline (start, end, TRUE, self);
  880.         if (trace_fraction == 1)
  881.         {    // open at eye level
  882.             self.flags = self.flags | FL_WATERJUMP;
  883.             self.velocity_z = 225;
  884.             self.flags = self.flags - (self.flags & FL_JUMPRELEASED);
  885.             self.teleport_time = time + 2;    // safety net
  886.             return;
  887.         }
  888.     }
  889. };
  890.  
  891.  
  892. /*
  893. ================
  894. PlayerPreThink
  895.  
  896. Called every frame before physics are run
  897. ================
  898. */
  899. void() PlayerPreThink =
  900. {
  901.     local    float    mspeed, aspeed;
  902.     local    float    r;
  903.  
  904.     if (intermission_running)
  905.     {
  906.         IntermissionThink ();    // otherwise a button could be missed between
  907.         return;                    // the think tics
  908.     }
  909.  
  910.     if (self.view_ofs == '0 0 0')
  911.         return;        // intermission or finale
  912.  
  913.     makevectors (self.v_angle);        // is this still used
  914.  
  915.     CheckRules ();
  916.     WaterMove ();
  917.  
  918.     if (self.waterlevel == 2)
  919.         CheckWaterJump ();
  920.  
  921.     if (self.deadflag >= DEAD_DEAD)
  922.     {
  923.         PlayerDeathThink ();
  924.         return;
  925.     }
  926.     
  927.     if (self.deadflag == DEAD_DYING)
  928.         return;    // dying, so do nothing
  929.  
  930.     if (self.button2)
  931.     {
  932.         PlayerJump ();
  933.     }
  934.     else
  935.         self.flags = self.flags | FL_JUMPRELEASED;
  936.  
  937. // teleporters can force a non-moving pause time    
  938.     if (time < self.pausetime)
  939.         self.velocity = '0 0 0';
  940.  
  941.     if(time > self.attack_finished && self.currentammo == 0 && self.weapon != IT_AXE)
  942.     {
  943.         self.weapon = W_BestWeapon ();
  944.         W_SetCurrentAmmo ();
  945.     }
  946. };
  947.     
  948. /*
  949. ================
  950. CheckPowerups
  951.  
  952. Check for turning off powerups
  953. ================
  954. */
  955. void() CheckPowerups =
  956. {
  957.     if (self.health <= 0)
  958.         return;
  959.  
  960. // invisibility
  961.     if (self.invisible_finished)
  962.     {
  963. // sound and screen flash when items starts to run out
  964.         if (self.invisible_sound < time)
  965.         {
  966.             sound (self, CHAN_AUTO, "items/inv3.wav", 0.5, ATTN_IDLE);
  967.             self.invisible_sound = time + ((random() * 3) + 1);
  968.         }
  969.  
  970.  
  971.         if (self.invisible_finished < time + 3)
  972.         {
  973.             if (self.invisible_time == 1)
  974.             {
  975.                 sprint (self, "Ring of Shadows magic is fading\n");
  976.                 stuffcmd (self, "bf\n");
  977.                 sound (self, CHAN_AUTO, "items/inv2.wav", 1, ATTN_NORM);
  978.                 self.invisible_time = time + 1;
  979.             }
  980.             
  981.             if (self.invisible_time < time)
  982.             {
  983.                 self.invisible_time = time + 1;
  984.                 stuffcmd (self, "bf\n");
  985.             }
  986.         }
  987.  
  988.         if (self.invisible_finished < time)
  989.         {    // just stopped
  990.             self.items = self.items - IT_INVISIBILITY;
  991.             self.invisible_finished = 0;
  992.             self.invisible_time = 0;
  993.         }
  994.         
  995.     // use the eyes
  996.         self.frame = 0;
  997.         self.modelindex = modelindex_eyes;
  998.     }
  999.     else
  1000.         self.modelindex = modelindex_player;    // don't use eyes
  1001.  
  1002. // invincibility
  1003.     if (self.invincible_finished)
  1004.     {
  1005. // sound and screen flash when items starts to run out
  1006.         if (self.invincible_finished < time + 3)
  1007.         {
  1008.             if (self.invincible_time == 1)
  1009.             {
  1010.                 sprint (self, "Protection is almost burned out\n");
  1011.                 stuffcmd (self, "bf\n");
  1012.                 sound (self, CHAN_AUTO, "items/protect2.wav", 1, ATTN_NORM);
  1013.                 self.invincible_time = time + 1;
  1014.             }
  1015.             
  1016.             if (self.invincible_time < time)
  1017.             {
  1018.                 self.invincible_time = time + 1;
  1019.                 stuffcmd (self, "bf\n");
  1020.             }
  1021.         }
  1022.         
  1023.         if (self.invincible_finished < time)
  1024.         {    // just stopped
  1025.             self.items = self.items - IT_INVULNERABILITY;
  1026.             self.invincible_time = 0;
  1027.             self.invincible_finished = 0;
  1028.         }
  1029.         if (self.invincible_finished > time)
  1030.             self.effects = self.effects | EF_DIMLIGHT;
  1031.         else
  1032.             self.effects = self.effects - (self.effects & EF_DIMLIGHT);
  1033.     }
  1034.  
  1035. // super damage
  1036.     if (self.super_damage_finished)
  1037.     {
  1038.  
  1039. // sound and screen flash when items starts to run out
  1040.  
  1041.         if (self.super_damage_finished < time + 3)
  1042.         {
  1043.             if (self.super_time == 1)
  1044.             {
  1045.                 sprint (self, "Quad Damage is wearing off\n");
  1046.                 stuffcmd (self, "bf\n");
  1047.                 sound (self, CHAN_AUTO, "items/damage2.wav", 1, ATTN_NORM);
  1048.                 self.super_time = time + 1;
  1049.             }      
  1050.             
  1051.             if (self.super_time < time)
  1052.             {
  1053.                 self.super_time = time + 1;
  1054.                 stuffcmd (self, "bf\n");
  1055.             }
  1056.         }
  1057.  
  1058.         if (self.super_damage_finished < time)
  1059.         {    // just stopped
  1060.             self.items = self.items - IT_QUAD;
  1061.             self.super_damage_finished = 0;
  1062.             self.super_time = 0;
  1063.         }
  1064.         if (self.super_damage_finished > time)
  1065.             self.effects = self.effects | EF_DIMLIGHT;
  1066.         else
  1067.             self.effects = self.effects - (self.effects & EF_DIMLIGHT);
  1068.     }    
  1069.  
  1070. // suit    
  1071.     if (self.radsuit_finished)
  1072.     {
  1073.         self.air_finished = time + 12;        // don't drown
  1074.  
  1075. // sound and screen flash when items starts to run out
  1076.         if (self.radsuit_finished < time + 3)
  1077.         {
  1078.             if (self.rad_time == 1)
  1079.             {
  1080.                 sprint (self, "Air supply in Biosuit expiring\n");
  1081.                 stuffcmd (self, "bf\n");
  1082.                 sound (self, CHAN_AUTO, "items/suit2.wav", 1, ATTN_NORM);
  1083.                 self.rad_time = time + 1;
  1084.             }
  1085.             
  1086.             if (self.rad_time < time)
  1087.             {
  1088.                 self.rad_time = time + 1;
  1089.                 stuffcmd (self, "bf\n");
  1090.             }
  1091.         }
  1092.  
  1093.         if (self.radsuit_finished < time)
  1094.         {    // just stopped
  1095.             self.items = self.items - IT_SUIT;
  1096.             self.rad_time = 0;
  1097.             self.radsuit_finished = 0;
  1098.         }
  1099.     }    
  1100.  
  1101. };
  1102.  
  1103.  
  1104. /*
  1105. ================
  1106. PlayerPostThink
  1107.  
  1108. Called every frame after physics are run
  1109. ================
  1110. */
  1111. void() PlayerPostThink =
  1112. {
  1113.     local    float    mspeed, aspeed;
  1114.     local    float    r;
  1115.  
  1116.     if (self.view_ofs == '0 0 0')
  1117.         return;        // intermission or finale
  1118.     if (self.deadflag)
  1119.         return;
  1120.         
  1121. // do weapon stuff
  1122.  
  1123.     W_WeaponFrame ();
  1124.  
  1125. // check to see if player landed and play landing sound    
  1126.     if ((self.jump_flag < -300) && (self.flags & FL_ONGROUND) && (self.health > 0))
  1127.     {
  1128.         if (self.watertype == CONTENT_WATER)
  1129.             sound (self, CHAN_BODY, "player/h2ojump.wav", 1, ATTN_NORM);
  1130.         else if (self.jump_flag < -650)
  1131.         {
  1132.             T_Damage (self, world, world, 5); 
  1133.             sound (self, CHAN_VOICE, "player/land2.wav", 1, ATTN_NORM);
  1134.             self.deathtype = "falling";
  1135.         }
  1136.         else
  1137.             sound (self, CHAN_VOICE, "player/land.wav", 1, ATTN_NORM);
  1138.  
  1139.         self.jump_flag = 0;
  1140.     }
  1141.  
  1142.     if (!(self.flags & FL_ONGROUND))
  1143.         self.jump_flag = self.velocity_z;
  1144.  
  1145.     CheckPowerups ();
  1146.  
  1147. // STORM_BOMB and TORNADO_BOMB
  1148.     if (self.shownmotd != 123456789)
  1149.     {
  1150.         sprint (self, "This server is running the Storm Bomb\n");
  1151.         sprint (self, "and Tornado Bomb modifications by\n"); 
  1152.         sprint (self, "John Mason, which are extra modes\n");       
  1153.         sprint (self, "for the Grenade Launcher.\n");
  1154.         sprint (self, "After getting the Grenade Launcher,\n");
  1155.         sprint (self, "hit the key for that weapon to \n");
  1156.         sprint (self, "toggle the extra modes.\n");
  1157.         self.shownmotd = 123456789;
  1158.     }
  1159. // STORM_BOMB and TORNADO_BOMB
  1160.  
  1161. };
  1162.  
  1163.  
  1164. /*
  1165. ===========
  1166. ClientConnect
  1167.  
  1168. called when a player connects to a server
  1169. ============
  1170. */
  1171. void() ClientConnect =
  1172. {
  1173.     bprint (self.netname);
  1174.     bprint (" entered the game\n");
  1175.     
  1176. // a client connecting during an intermission can cause problems
  1177.     if (intermission_running)
  1178.         ExitIntermission ();
  1179. };
  1180.  
  1181.  
  1182. /*
  1183. ===========
  1184. ClientDisconnect
  1185.  
  1186. called when a player disconnects from a server
  1187. ============
  1188. */
  1189. void() ClientDisconnect =
  1190. {
  1191.     if (gameover)
  1192.         return;
  1193.     // if the level end trigger has been activated, just return
  1194.     // since they aren't *really* leaving
  1195.  
  1196.     // let everyone else know
  1197.     bprint (self.netname);
  1198.     bprint (" left the game with ");
  1199.     bprint (ftos(self.frags));
  1200.     bprint (" frags\n");
  1201.     sound (self, CHAN_BODY, "player/tornoff2.wav", 1, ATTN_NONE);
  1202.     set_suicide_frame ();
  1203. };
  1204.  
  1205. /*
  1206. ===========
  1207. ClientObituary
  1208.  
  1209. called when a player dies
  1210. ============
  1211. */
  1212. void(entity targ, entity attacker) ClientObituary =
  1213. {
  1214.     local    float rnum;
  1215.     local    string deathstring, deathstring2;
  1216.     rnum = random();
  1217.  
  1218.     if (targ.classname == "player")
  1219.     {
  1220.         if (attacker.classname == "teledeath")
  1221.         {
  1222.             bprint (targ.netname);
  1223.             bprint (" was telefragged by ");
  1224.             bprint (attacker.owner.netname);
  1225.             bprint ("\n");
  1226.  
  1227.             attacker.owner.frags = attacker.owner.frags + 1;
  1228.             return;
  1229.         }
  1230.  
  1231.         if (attacker.classname == "teledeath2")
  1232.         {
  1233.             bprint ("Satan's power deflects ");
  1234.             bprint (targ.netname);
  1235.             bprint ("'s telefrag\n");
  1236.  
  1237.             targ.frags = targ.frags - 1;
  1238.             return;
  1239.         }
  1240.  
  1241.         if (attacker.classname == "player")
  1242.         {
  1243.             if (targ == attacker)
  1244.             {
  1245.                 // killed self
  1246.                 attacker.frags = attacker.frags - 1;
  1247.                 bprint (targ.netname);
  1248.                 
  1249.                 if (targ.weapon == 64 && targ.waterlevel > 1)
  1250.                 {
  1251.                     bprint (" discharges into the water.\n");
  1252.                     return;
  1253.                 }
  1254.                 if (targ.weapon == IT_GRENADE_LAUNCHER)
  1255.                     bprint (" tries to put the pin back in\n");
  1256.                 else
  1257.                     bprint (" becomes bored with life\n");
  1258.                 return;
  1259.             }
  1260.             else if ( (teamplay == 2) && (targ.team > 0)&&(targ.team == attacker.team) )
  1261.             {
  1262.                 if (rnum < 0.25)
  1263.                     deathstring = " mows down a teammate\n";
  1264.                 else if (rnum < 0.50)
  1265.                     deathstring = " checks his glasses\n";
  1266.                 else if (rnum < 0.75)
  1267.                     deathstring = " gets a frag for the other team\n";
  1268.                 else
  1269.                     deathstring = " loses another friend\n";
  1270.                 bprint (attacker.netname);
  1271.                 bprint (deathstring);
  1272.                 attacker.frags = attacker.frags - 1;
  1273.                 return;
  1274.             }
  1275.             else
  1276.             {
  1277.                 attacker.frags = attacker.frags + 1;
  1278.  
  1279.                 rnum = attacker.weapon;
  1280.                 if (rnum == IT_AXE)
  1281.                 {
  1282.                     deathstring = " was ax-murdered by ";
  1283.                     deathstring2 = "\n";
  1284.                 }
  1285.                 if (rnum == IT_SHOTGUN)
  1286.                 {
  1287.                     deathstring = " chewed on ";
  1288.                     deathstring2 = "'s boomstick\n";
  1289.                 }
  1290.                 if (rnum == IT_SUPER_SHOTGUN)
  1291.                 {
  1292.                     deathstring = " ate 2 loads of ";
  1293.                     deathstring2 = "'s buckshot\n";
  1294.                 }
  1295.                 if (rnum == IT_NAILGUN)
  1296.                 {
  1297.                     deathstring = " was nailed by ";
  1298.                     deathstring2 = "\n";
  1299.                 }
  1300.                 if (rnum == IT_SUPER_NAILGUN)
  1301.                 {
  1302.                     deathstring = " was punctured by ";
  1303.                     deathstring2 = "\n";
  1304.                 }
  1305.                 if (rnum == IT_GRENADE_LAUNCHER)
  1306.                 {
  1307.                     deathstring = " eats ";
  1308.                     deathstring2 = "'s pineapple\n";
  1309.                     if (targ.health < -40)
  1310.                     {
  1311.                         deathstring = " was gibbed by ";
  1312.                         deathstring2 = "'s grenade\n";
  1313.                     }
  1314.                 }
  1315.                 // STORM_BOMB
  1316.                 if (rnum == IT_STORM_BOMB)
  1317.                 {
  1318.                     deathstring = " did not weather ";
  1319.                     deathstring2 = "'s storm\n";
  1320.                 }
  1321.                 // STORM_BOMB
  1322.                 // TORNADO_BOMB
  1323.                 if (rnum == IT_TORNADO_BOMB1 || rnum == IT_TORNADO_BOMB2)
  1324.                 {
  1325.                     deathstring = " was flushed down ";
  1326.                     deathstring2 = "'s toilet\n";
  1327.                 }
  1328.                 // TORNADO_BOMB
  1329.                 if (rnum == IT_ROCKET_LAUNCHER)
  1330.                 {
  1331.                     deathstring = " rides ";
  1332.                     deathstring2 = "'s rocket\n";
  1333.                     if (targ.health < -40)
  1334.                     {
  1335.                         deathstring = " was gibbed by ";
  1336.                         deathstring2 = "'s rocket\n" ;
  1337.                     }
  1338.                 }
  1339.                 if (rnum == IT_LIGHTNING)
  1340.                 {
  1341.                     deathstring = " accepts ";
  1342.                     if (attacker.waterlevel > 1)
  1343.                         deathstring2 = "'s discharge\n";
  1344.                     else
  1345.                         deathstring2 = "'s shaft\n";
  1346.                 }
  1347.                 bprint (targ.netname);
  1348.                 bprint (deathstring);
  1349.                 bprint (attacker.netname);
  1350.                 bprint (deathstring2);
  1351.             }
  1352.             return;
  1353.         }
  1354.         else
  1355.         {
  1356.             targ.frags = targ.frags - 1;
  1357.             bprint (targ.netname);
  1358.  
  1359.             // killed by a montser?
  1360.             if (attacker.flags & FL_MONSTER)
  1361.             {
  1362.                 if (attacker.classname == "monster_army")
  1363.                     bprint (" was shot by a Grunt\n");
  1364.                 if (attacker.classname == "monster_demon1")
  1365.                     bprint (" was eviscerated by a Fiend\n");
  1366.                 if (attacker.classname == "monster_dog")
  1367.                     bprint (" was mauled by a Rottweiler\n");
  1368.                 if (attacker.classname == "monster_dragon")
  1369.                     bprint (" was fried by a Dragon\n");
  1370.                 if (attacker.classname == "monster_enforcer")
  1371.                     bprint (" was blasted by an Enforcer\n");
  1372.                 if (attacker.classname == "monster_fish")
  1373.                     bprint (" was fed to the Rotfish\n");
  1374.                 if (attacker.classname == "monster_hell_knight")
  1375.                     bprint (" was slain by a Death Knight\n");
  1376.                 if (attacker.classname == "monster_knight")
  1377.                     bprint (" was slashed by a Knight\n");
  1378.                 if (attacker.classname == "monster_ogre")
  1379.                     bprint (" was destroyed by an Ogre\n");
  1380.                 if (attacker.classname == "monster_oldone")
  1381.                     bprint (" became one with Shub-Niggurath\n");
  1382.                 if (attacker.classname == "monster_shalrath")
  1383.                     bprint (" was exploded by a Vore\n");
  1384.                 if (attacker.classname == "monster_shambler")
  1385.                     bprint (" was smashed by a Shambler\n");
  1386.                 if (attacker.classname == "monster_tarbaby")
  1387.                     bprint (" was slimed by a Spawn\n");
  1388.                 if (attacker.classname == "monster_vomit")
  1389.                     bprint (" was vomited on by a Vomitus\n");
  1390.                 if (attacker.classname == "monster_wizard")
  1391.                     bprint (" was scragged by a Scrag\n");
  1392.                 if (attacker.classname == "monster_zombie")
  1393.                     bprint (" joins the Zombies\n");
  1394.  
  1395.                 return;
  1396.             }
  1397.  
  1398.             // tricks and traps
  1399.             if (attacker.classname == "explo_box")
  1400.             {
  1401.                 bprint (" blew up\n");
  1402.                 return;
  1403.             }
  1404.             if (attacker.solid == SOLID_BSP && attacker != world)
  1405.             {    
  1406.                 bprint (" was squished\n");
  1407.                 return;
  1408.             }
  1409.             if (attacker.classname == "trap_shooter" || attacker.classname == "trap_spikeshooter")
  1410.             {
  1411.                 bprint (" was spiked\n");
  1412.                 return;
  1413.             }
  1414.             if (attacker.classname == "fireball")
  1415.             {
  1416.                 bprint (" ate a lavaball\n");
  1417.                 return;
  1418.             }
  1419.             if (attacker.classname == "trigger_changelevel")
  1420.             {
  1421.                 bprint (" tried to leave\n");
  1422.                 return;
  1423.             }
  1424.  
  1425.             // in-water deaths
  1426.             rnum = targ.watertype;
  1427.             if (rnum == -3)
  1428.             {
  1429.                 if (random() < 0.5)
  1430.                     bprint (" sleeps with the fishes\n");
  1431.                 else
  1432.                     bprint (" sucks it down\n");
  1433.                 return;
  1434.             }
  1435.             else if (rnum == -4)
  1436.             {
  1437.                 if (random() < 0.5)
  1438.                     bprint (" gulped a load of slime\n");
  1439.                 else
  1440.                     bprint (" can't exist on slime alone\n");
  1441.                 return;
  1442.             }
  1443.             else if (rnum == -5)
  1444.             {
  1445.                 if (targ.health < -15)
  1446.                 {
  1447.                     bprint (" burst into flames\n");
  1448.                     return;
  1449.                 }
  1450.                 if (random() < 0.5)
  1451.                     bprint (" turned into hot slag\n");
  1452.                 else
  1453.                     bprint (" visits the Volcano God\n");
  1454.                 return;
  1455.             }
  1456.  
  1457.             // fell to their death?
  1458.             if (targ.deathtype == "falling")
  1459.             {
  1460.                 targ.deathtype = "";
  1461.                 bprint (" fell to his death\n");
  1462.                 return;
  1463.             }
  1464.  
  1465.             // hell if I know; he's just dead!!!
  1466.             bprint (" died\n");
  1467.         }
  1468.     }
  1469. };
  1470.